import request from '@/utils/request'

// 查询任务列表
export function listTask(query) {
  return request({
    url: '/task/list',
    method: 'get',
    params: query
  })
}

// 查询任务详细
export function getTask(taskId) {
  return request({
    url: '/task/' + taskId,
    method: 'get'
  })
}

// 新增任务
export function addTask(data) {
  return request({
    url: '/task',
    method: 'post',
    data: data
  })
}

//复制任务
export function cloneTask(taskId,taskNo) {
  const data = {
    taskId,
    taskNo
  }
  return request({
    url: '/task/cloneTask',
    method: 'post',
    data: data
  })
}

// 修改任务
export function updateTask(data) {
  return request({
    url: '/task/edit',
    method: 'post',
    data: data
  })
}

// 修改任务启用状态
export function changeTaskStatus(taskId, status) {
  const data = {
    taskId,
    status
  }
  return request({
    url: '/task/changeTaskStatus',
    method: 'post',
    data: data
  })
}

// 删除任务
export function delTask(taskId) {
  return request({
    url: '/task/' + taskId,
    method: 'delete'
  })
}
